package com.wl.sta.schedule;

import com.wl.sta.service.StatisticsDailyService;
import com.wl.sta.utils.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author lei.wan
 * @since 2021/9/7
 */
@Component
public class ScheduleTask {

    @Autowired
    private StatisticsDailyService statsDailyService;

    @Scheduled(cron = "0 0 1 * * ?")
    public void task(){
        statsDailyService.registerCount(DateUtil.formatDate(DateUtil.addDays(new Date(),-1)));
    }

}
